package mc

import (
	"gitee.com/dreamwood/ez-go/db/mgo"
)

const (
	AttributeKeyEventNew           = "wms.AttributeKeyNew"
	AttributeKeyEventBeforeCreate  = "wms.AttributeKeyBeforeCreate"
	AttributeKeyEventBeforeUpdate  = "wms.AttributeKeyBeforeUpdate"
	AttributeKeyEventBeforeSave    = "wms.AttributeKeyBeforeCreate wms.AttributeKeyBeforeUpdate"
	AttributeKeyEventAfterCreate   = "wms.AttributeKeyAfterCreate"
	AttributeKeyEventAfterUpdate   = "wms.AttributeKeyAfterUpdate"
	AttributeKeyEventAfterSave     = "wms.AttributeKeyAfterCreate wms.AttributeKeyAfterUpdate"
	AttributeKeyEventDelete        = "wms.AttributeKeyDelete"
	AttributeKeyAccessControlEvent = "wms.AttributeKeyAccessControl"
)

func GetAttributeKeyConfig() *mgo.DocConfig {
	return AttributeKey_Config
}

var AttributeKey_Config *mgo.DocConfig

func init() {
	AttributeKey_Config = NewAttributeKeyConfig()
}
func NewAttributeKeyConfig() *mgo.DocConfig {
	return &mgo.DocConfig{
		ContainerKey: "wms.AttributeKey",
		Fields: []string{
			"name", "code", "note", "values",
		},
		RelationFields: []string{
			"values",
		},
		RelationConfigs: map[string]*mgo.DocRelation{
			"values": {
				Config:     GetAttributeValueConfig,
				DocName:    "AttributeValue",
				JoinType:   "M",
				KeyInside:  "id",
				KeyOutSide: "valuesIds",
			},
		},
		FieldFilter: map[string]*mgo.DocFieldFilter{
			"default": {
				Select: []string{},
				Omit:   []string{},
			},
		},
	}
}
